-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Plugin errors consolidator #4863
ENH: Plugin errors consolidator #4863
Conversation
Signed-off-by: George Chen <qchea@amazon.com>
Signed-off-by: George Chen <qchea@amazon.com>
final List<PluginError> extensionPluginErrors = pluginErrorCollector.getPluginErrors() | ||
.stream().filter(pluginError -> PipelinesDataFlowModel.EXTENSION_PLUGIN_TYPE | ||
.equals(pluginError.getComponentType())) | ||
.collect(Collectors.toList()); | ||
if (!extensionPluginErrors.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have one of the unit tests cover this filtering? to verify that if there are pluginErrors with type other than "extension", they will be filtered out.
import java.util.stream.IntStream; | ||
|
||
@Named | ||
public class PluginErrorsConsolidator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think rather than make this a consolidator that creates a string, a more flexible approach would be to make a PluginErrorsHandler
. Let it decide how to handle multiple errors. Maybe it handles it by creating a structured object. Maybe it handles it by logging. Maybe by stdout.
public interface PluginErrorsHandler {
public void handleErrors(final Collection<PluginError> pluginErrors);
}
And then we can have a default which logs:
@Named
public class LoggingPluginErrorsHandler implements PluginErrorsHandler {
public void handleErrors(final Collection<PluginError> pluginErrors) {
// build string
// log to Slf4j
}
}
Signed-off-by: George Chen <qchea@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for making this improvement!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a build failure with checkStyle.
Signed-off-by: George Chen <qchea@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'm good with it once build succeeds.
Signed-off-by: George Chen <qchea@amazon.com>
Description
This is an enhancement on consolidated plugin error messages to make sure error messages are filtered.
Issues Resolved
Resolves #4854
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.